<?php 
session_start();
class charts extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       private $_configs = null;
       function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('javascript');
            $this->load->library('session');
            $this->load->library('smarty3','','smarty');
            $this->_configs["title"]="Báo Cáo - Biểu Đồ";
            $this->_configs["authority"]="chart";
            $this->_configs["MinAuthority"]=0;
            $this->load->model('admin-planners/report_model','report_model');
            if($this->checkauthority()<0){AccessDenied();}
        }
        public function checkauthority(){
            if(isset($_SESSION["ADP-USER"]["AUTHORITY"])){
                $myau=-1;
                if(is_array($_SESSION["ADP-USER"]["AUTHORITY"])){
                    foreach ($_SESSION["ADP-USER"]["AUTHORITY"] as $au){
                        if($au["keyword"]=="view" && $myau==-1)$myau=0;
                        if($au["keyword"]=="admin")$myau=1;
                        if($au["keyword"]==$this->_configs["authority"]){
                            if($au["value"]==0 && $myau==-1) $myau=0;
                            if($au["value"]==1) $myau=1;
                        }
                    }
                }
                return $myau>=$this->_configs["MinAuthority"]?$myau:-1;
            }return -1;
        }
        public function index()
	{
            redirect(base_url("admin-planners/charts/Line_Series_Month"));
	}
        public function Line_Series_Month($month=null,$year=null){
            $this->smarty->assign('_SESSION', $_SESSION);
            $configs=$this->_configs;
            
            if($month==null)$month=date("m");
            if($year==null)$year=date("Y");
            $configs["ifram"]=base_url("admin-planners/chart/Line_Series_Month/$month/$year");
            $configs["month"]=$month;
            $configs["year"]=$year;
            $configs["ChartType"]="month";
            $this->smarty->assign('configs',$configs );
            $this->smarty->view('admin-planners/chart/00_chart','contentofview');
            $this->smarty->view('admin-planners/00_1_styles','styles');
            $this->smarty->view('admin-planners/00_2_scripts','scripts');
            $this->smarty->view('admin-planners/00_3_menus','menus');
            $this->smarty->view('admin-planners/10_template','view');
            $this->smarty->display('admin-planners/01_manage');
        }
        public function Line_Series_Symbol_Year($year=null){
            $this->smarty->assign('_SESSION', $_SESSION);
            $configs=$this->_configs;
            if($year==null)$year=date("Y");
            $configs["year"]=$year;
            $configs["ChartType"]="year";
            $configs["ifram"]=base_url("admin-planners/chart/Line_Series_Symbol_Year/$year");
            $this->smarty->assign('configs',$configs );
            $this->smarty->view('admin-planners/chart/00_chart','contentofview');
            $this->smarty->view('admin-planners/00_1_styles','styles');
            $this->smarty->view('admin-planners/00_2_scripts','scripts');
            $this->smarty->view('admin-planners/00_3_menus','menus');
            $this->smarty->view('admin-planners/10_template','view');
            $this->smarty->display('admin-planners/01_manage');
        }
        public function Chart_Donut_Year($year=null){
            $this->smarty->assign('_SESSION', $_SESSION);
            $configs=$this->_configs;
            if($year==null)$year=date("Y");
            $configs["year"]=$year;
            $configs["ChartType"]="donutyear";
            $configs["ifram"]=base_url("admin-planners/chart/Chart_Donut_Year/$year");
            $this->smarty->assign('configs',$configs );
            $this->smarty->view('admin-planners/chart/00_chart','contentofview');
            $this->smarty->view('admin-planners/00_1_styles','styles');
            $this->smarty->view('admin-planners/00_2_scripts','scripts');
            $this->smarty->view('admin-planners/00_3_menus','menus');
            $this->smarty->view('admin-planners/10_template','view');
            $this->smarty->display('admin-planners/01_manage');
        }
        public function Chart_Gray_Scale_Month($month=null,$year=null){
            $this->smarty->assign('_SESSION', $_SESSION);
            $configs=$this->_configs;
            if($month==null)$month=date("m");
            if($year==null)$year=date("Y");
            $configs["month"]=$month;
            $configs["year"]=$year;
            $configs["ChartType"]="scalemonth";
            $configs["ifram"]=base_url("admin-planners/chart/Chart_Gray_Scale_Month/$month/$year");
            $this->smarty->assign('configs',$configs );
            $this->smarty->view('admin-planners/chart/00_chart','contentofview');
            $this->smarty->view('admin-planners/00_1_styles','styles');
            $this->smarty->view('admin-planners/00_2_scripts','scripts');
            $this->smarty->view('admin-planners/00_3_menus','menus');
            $this->smarty->view('admin-planners/10_template','view');
            $this->smarty->display('admin-planners/01_manage');
        }
        public function Chart_Gray_Scale_Year($year=null){
            $this->smarty->assign('_SESSION', $_SESSION);
            $configs=$this->_configs;
            if($year==null)$year=date("Y");
            $configs["year"]=$year;
            $configs["ChartType"]="scaleyear";
            $configs["ifram"]=base_url("admin-planners/chart/Chart_Gray_Scale_Year/$year");
            $this->smarty->assign('configs',$configs );
            $this->smarty->view('admin-planners/chart/00_chart','contentofview');
            $this->smarty->view('admin-planners/00_1_styles','styles');
            $this->smarty->view('admin-planners/00_2_scripts','scripts');
            $this->smarty->view('admin-planners/00_3_menus','menus');
            $this->smarty->view('admin-planners/10_template','view');
            $this->smarty->display('admin-planners/01_manage');
        }
       
        
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */